package com.engineering.elink.util;

import java.util.Collection;
import java.util.Map;

/**
 * 
 * 集合工具类
 */
public class CollectionUtil {
	/** @Fields logger : 日志工具类 */
	// private static Logger logger = Logger.getLogger(CollectionUtil.class);

	/**
	 * 判断Collection是否不为空
	 * 
	 * @param collection
	 *            需要判断的Collection
	 * @return boolean
	 */
	public static boolean collectionIsNotEmpty(Collection<?> collection) {
		return !collectionIsEmpty(collection);
	}

	/**
	 * 判断Collection是否为空
	 * 
	 * @param collection
	 *            需要判断的Collection
	 * @return boolean
	 */
	public static boolean collectionIsEmpty(Collection<?> collection) {
		if (collection == null || collection.size() == 0) {
			return true;
		}
		return false;
	}

	/**
	 * 判断Map是否不为空
	 * 
	 * @param map
	 *            需要判断的Collection
	 * @return boolean
	 */
	public static boolean collectionIsNotEmpty(Map<Object, Object> map) {
		return !collectionIsEmpty(map);
	}

	/**
	 * 判断Map是否为空
	 * 
	 * @param map
	 *            需要判断的Collection
	 * @return boolean
	 */
	public static boolean collectionIsEmpty(Map<Object, Object> map) {
		if (map == null || map.size() == 0) {
			return true;
		}
		return false;
	}

	/**
	 * 判断对象数组是否为空
	 * 
	 * @param objs
	 *            需要判断的对象数组
	 * @return boolean
	 */
	public static boolean arrayIsNotEmpty(Object[] objs) {
		if (objs == null || objs.length == 0) {
			return false;
		}
		return true;
	}

	/**
	 * 判断对象数组是否为空
	 * 
	 * @param objs
	 *            需要判断的对象数组
	 * @return boolean
	 */
	public static boolean arrayIsEmpty(Object[] objs) {
		if (objs == null || objs.length == 0) {
			return true;
		}
		return false;
	}
	public static Boolean isNull(Object o) {
		return o == null;
	}

}
